
/**
 * Created by michaelbottjer on 11/04/2014.
 */

import static java.lang.System.out;

public class Asterisk {

    public static void printOne(){
        out.println("*");
    }

    public static void horizontalLine(int n){
        for(int i=1; i <= n; i++){
            out.print("*");
        }
    }

    public static void verticalLine(int n){
        for(int i=1; i <= n; i++){
            out.println("*");
        }
    }

    public static void rightTriangle(int n){
        for(int i=1; i <= n; i++){
            Asterisk.horizontalLine(i);
            out.println("");
        }
    }

    public static void printBlank(int n){
        for(int i = n; i == 0; i--){
            out.print(" ");
        }
    }

    public static void isocelesTriangle(int numOfRows){

         for(int i=1; i <= numOfRows; i++ ){
            for(int k=i; k<numOfRows; k++ ){
                out.print(" ");
            }
            for(int h=1; h < 2*i ; h++){
                out.print("*");
            }
            out.println("");
        }

    }

    public static void bottomOfDiamond(int oneLessCenterRow){
        for(int i=oneLessCenterRow; i > 0; i-- ){
            for(int k=i; k<oneLessCenterRow+1 ; k++ ){
                out.print(" ");
            }
            for(int h=1; h < 2*i ; h++){
                out.print("*");
            }
            out.println("");
        }
    }

    public static void centeredDiamond(int centerRow){
        Asterisk.isocelesTriangle(centerRow);
        Asterisk.bottomOfDiamond(centerRow-1);

    }

    public static void nameCenteredDiamond(int numOfRows){
        for(int i=1; i <= numOfRows; i++ ){
            for(int k=i; k<numOfRows; k++ ){
                out.print(" ");
            }
            if(i!=numOfRows) {
                for (int h = 1; h < 2 * i; h++) {
                    out.print("*");
                }
            }else{
                out.print("Michael");
            }
            out.println("");
        }
        bottomOfDiamond(numOfRows-1);
    }

    public static void main(String [] args){
        Asterisk.printOne();
        Asterisk.horizontalLine(6);
        out.println("");
        Asterisk.verticalLine(3);
        Asterisk.rightTriangle(3);
        Asterisk.isocelesTriangle(5);
        Asterisk.centeredDiamond(5);
        Asterisk.nameCenteredDiamond(3);
    }

}
